package cate.common.table.activity.treasure.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.treasure.row.TreasureCallPoolRow;
import cate.common.util.random.RWList;

import java.util.List;
import java.util.stream.Collectors;

public class TreasureCallPoolSheet extends ESheet<TreasureCallPoolRow> {
    @Override
    public String getSheetName() {
        return "奖池";
    }

    public TreasureCallPoolRow randomPool(int groupId){
        List<TreasureCallPoolRow> rows = getList().stream().
                filter(row -> row.groupId == groupId).collect(Collectors.toList());
        if (rows.isEmpty()) {
            return null;
        }
        RWList<TreasureCallPoolRow> rwList = new RWList<>();
        rwList.addAll(rows);
        return rwList.setup().get();
    }
}
